home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacFormat 1997 April
/
macformat-049.iso
/
mac
/
Shareware Plus
/
Developers
/
dropg++
/
usr
/
src
/
examples
/
stat.cc
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1996-10-31
|
425 b
|
17 lines
|
[
TEXT/R*ch
]
#include <stdlib.h>
#include <iomanip.h>
#include <sys/types.h>
#include <sys/stat.h>
main(int argc, char **argv)
{
char name[99];
struct stat statbuf;
strcpy(name, argv[argc-1]);
if (stat(name, &statbuf)) perror(name),exit(-2);
cout << "File size = ";
cout << dec << statbuf.st_size << " bytes(" ;
cout << hex << statbuf.st_size << " hex)" ;
cout << endl;
}